<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<meta charset="utf-8">
	<title>添加新便利服务 - ${siteName}</title>
	<meta name="description" content="">
	<meta name="author" content="xuzewei">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
	<link rel="stylesheet" type="text/css" href="css/cloud-admin.css" >
	<link rel="stylesheet" type="text/css" href="css/themes/default.css" id="skin-switcher" >
	<link rel="stylesheet" type="text/css" href="css/responsive.css" >
	<link rel="stylesheet" type="text/css" href="font-awesome/css/font-awesome.min.css">
	<!-- JQUERY UI-->
	<link rel="stylesheet" type="text/css" href="js/jquery-ui-1.10.3.custom/css/custom-theme/jquery-ui-1.10.3.custom.min.css" />
	<!-- DATE RANGE PICKER -->
	<link rel="stylesheet" type="text/css" href="js/bootstrap-daterangepicker/daterangepicker-bs3.css" />
	<!-- JQGRID -->
	<link rel="stylesheet" type="text/css" href="js/jqgrid/css/ui.jqgrid.min.css" />
	<!-- HUBSPOT MESSENGER -->
	<link rel="stylesheet" type="text/css" href="js/hubspot-messenger/css/messenger.min.css" />
	<link rel="stylesheet" type="text/css" href="js/hubspot-messenger/css/messenger-theme-flat.min.css" />
	<link rel="stylesheet" type="text/css" href="css/base.css" />
	<link rel="stylesheet" type="text/css" href="css/main.css" />
	<script type="text/javascript">
	    window.ZBJInfo = {
	        baseURI: "zbj.com",
	        newStaticLibURI: "http://t6.zbjimg.com",
	        qiniuUploadTokenUrl: "http://rms.zhubajie.com"
	    };
	    window.ZBJInfo.attach_list = [{"file_id":"7729683","filename":"homesite\/task\/%u65B0%u5EFA%u6587%u672C%u6587%u6863.txt\/origine\/b62bdc7e-4400-4b67-b004-a9834a05be04","ofilename":"\u65b0\u5efa\u6587\u672c\u6587\u6863.txt","createtime":"1450085834","task_id":"6360159","filesize":"1","filext":"txt","user_id":"44","nickname":"cc01","tfPath":"","soundtimea":"0"},{"file_id":"7729685","filename":"homesite\/task\/%u4EFB%u610F%u7C7B%u578B.m4a\/origine\/1436d51d-5aa0-4eb9-bc06-b66721a28f5e","ofilename":"\u4efb\u610f\u7c7b\u578b.m4a","createtime":"1450085834","task_id":"6360159","filesize":"8388607","filext":"m4a","user_id":"44","nickname":"cc01","tfPath":"","soundtimea":"0"}] || [];
	</script>
	<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/1.9.0/jquery.min.js"></script>
	<script type="text/javascript" id="seajsnode" src="http://t6.zbjimg.com/seajs/seajs/2.1.1/sea.js"></script>
	<script type="text/javascript" src="http://t6.zbjimg.com/seajs/seajs-style/1.0.0/seajs-style.js"></script>
	<script type="text/javascript" src="http://t6.zbjimg.com/output/seajs-config.js"></script>
</head>
<body id="app" ng-app="app" ng-controller="ctrl">
	<!-- HEADER -->
	<jsp:include page="include/header.jsp" />
	<!--/HEADER -->
	<!-- PAGE -->
	<section id="page">
		<!-- SIDEBAR -->
		<jsp:include page="include/sidebar.jsp" />
		<!-- /SIDEBAR -->
		<div id="main-content">
			<div class="container">
				<div class="row">
					<div id="content" class="col-lg-12">
						<!-- PAGE HEADER-->
						<div class="row">
							<div class="col-sm-12">
								<div class="page-header">
									<!-- BREADCRUMBS -->
									<ul class="breadcrumb">
										<li>
											<i class="fa fa-home"></i>
											<a href="welcome.jsp">Home</a>
										</li>
									</ul>
									<!-- /BREADCRUMBS -->
									<div class="clearfix">
										<h3 class="content-title pull-left">添加新便利服务</h3>
									</div>
									<div class="description"></div>
								</div>
							</div>
						</div>
						<!-- /PAGE HEADER -->
						<div class="box border orange">
							<div class="box-title">
								<h4><i class="fa fa-bars"></i>添加新便利服务</h4>
							</div>
							<div class="box-body big">
								<form role="form">
									<div class="form-group">
									  <label>名称</label>
									  <input type="text" class="form-control" ng-model="name" placeholder="请输入25字内的名称">
									</div>
									<div class="form-group">
									  <label>地址</label>
									  <input type="text" class="form-control" ng-model="addr" placeholder="请输入地址">
									</div>
									<div class="form-group">
									  <label>联系方式</label>
									  <input type="text" class="form-control" ng-model="phone" placeholder="请输入联系方式">
									</div>
									<div class="form-group">
									  <label>简介</label>
									  <input type="text" class="form-control" ng-model="desc" placeholder="请输入简介">
									</div>
									<div class="form-group">
									  <h1>上传一张图片后展示成固定尺寸图片</h1>
									  <a href="javascript:;" id="extraInfoUploadBtn3" class="zbj-upload-btn">请选择一张图片</a><br/><br/>
									  <div class="demo-preview" id="demoPreview"></div>
									</div>
									<div class="form-group">
									  <label>说明</label>
									  <textarea class="form-control" ng-model="detail"  placeholder="请输入说明"></textarea>
									</div>
									<button type="submit" class="btn btn-danger" ng-click="submit()" >提交</button>
								</form>
							</div>
						</div>
						<div class="footer-tools">
							<span class="go-top">
								<i class="fa fa-chevron-up"></i> Top
							</span>
						</div>
					</div><!-- /CONTENT-->
				</div>
			</div>
		</div>
	</section>
	<!--/PAGE -->
	
	<!-- JAVASCRIPTS -->
	<!-- Placed at the end of the document so the pages load faster -->
	<!-- JQUERY -->
	<script src="js/jquery/jquery-2.0.3.min.js"></script>
	<!-- JQUERY UI-->
	<script src="js/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js"></script>
	<!-- BOOTSTRAP -->
	<script src="bootstrap-dist/js/bootstrap.min.js"></script>
	<!-- DATE RANGE PICKER -->
	<script src="js/bootstrap-daterangepicker/moment.min.js"></script>
	<script src="js/bootstrap-daterangepicker/daterangepicker.min.js"></script>
	<!-- SLIMSCROLL -->
	<script type="text/javascript" src="js/jQuery-slimScroll-1.3.0/jquery.slimscroll.min.js"></script>
	<script type="text/javascript" src="js/jQuery-slimScroll-1.3.0/slimScrollHorizontal.min.js"></script>
	<!-- BLOCK UI -->
	<script type="text/javascript" src="js/jQuery-BlockUI/jquery.blockUI.min.js"></script>
	<!-- JQGRID -->
	<script type="text/javascript" src="js/jqgrid/js/grid.locale-en.min.js"></script>
	<script type="text/javascript" src="js/jqgrid/js/jquery.jqGrid.min.js"></script>
	<!-- COOKIE -->
	<script type="text/javascript" src="js/jQuery-Cookie/jquery.cookie.min.js"></script>
	<!-- HUBSPOT MESSENGER -->
	<script type="text/javascript" src="js/hubspot-messenger/js/messenger.min.js"></script>
	<script type="text/javascript" src="js/hubspot-messenger/js/messenger-theme-flat.js"></script>
	<script type="text/javascript" src="js/hubspot-messenger/js/messenger-theme-future.js"></script>
	<script src="js/script.js"></script>
	<!-- CLOSURE-LIBRARY -->
	<script src="closure-library/closure/goog/base.js"></script>
	<!-- ANGULAR-LIBRARY -->
	<script src="angular-1.5.0-rc.2/angular.js"></script>
	<!-- CUSTOM SCRIPT -->
	<script src="include/common.js"></script>
	<script type="text/javascript">
	var self = this;
	var QINIU_UPLOAD_TOKEN_URL = ZBJInfo.qiniuUploadTokenUrl;
	var uploadedImgUrl = '';
	seajs.use(['components/uploader-qiniu/uploader-qiniu'], function(Uploader) {
	    var extraUploader = new Uploader.baseUploader({
	        browse_button: "extraInfoUploadBtn3",
	        acceptExt: [
	            { title : "Image files", extensions : "jpg,gif,png,bmp,jpeg,tif,eps" }
	        ],
	        prevent_duplicates : false,
	        max_file_size : "1024kb",
	        count_limit : 5,
	        belongToDomain: 'homesite',
	        belongToSystem: 'task',
	        tokenUrl: QINIU_UPLOAD_TOKEN_URL+'/resource/'
	    });
	    extraUploader.on('progress', function(up, file){
	        $('#demoPreview').html(file.percent+'%');
	    });
	    extraUploader.on('uploaded', function(up, file){
	        var key = extraUploader.tokenObj[file.name][1];
	        var url = extraUploader.getUrl(key).previewUrl;
	        uploadedImgUrl = url;
	        var previewUrl = url+'&s.w=200&s.h=200';
	        $('#demoPreview').html('<img src="'+previewUrl+'"/>');
	    });
	});
	</script>
	<script>
	var app = angular.module("app", []);
	app.controller('ctrl', function($scope, $http, $httpParamSerializer, $injector, $window) {
		$scope.applyAtatus = 0;
		
		$scope.submit = function() {
			var param = {
				"name": $scope.name,
				"addr": $scope.addr,
				"phone": $scope.phone,
				"desc": $scope.desc,
				"detail": $scope.detail,
				"imgUrl": uploadedImgUrl
			};
			jQuery.post("api/convenienceService/add", param, function(data) {
				isErr(data) ? showErrMsg(data) : showMsg('添加便利服务成功！');
			});
		}
		
		$scope.logout = function() {
			logout($window);
		};
	});
	</script>
	<script>
	jQuery(document).ready(function() {
		App.init();
		jQuery('#nav_article').click();
	});
	</script>
	<!-- /JAVASCRIPTS -->
</body>
</html>